package com.wwc.member.config;

import com.wwc.common.interceptor.LogInterceptor;
import com.wwc.common.interceptor.MemberInterceptor;
import jakarta.annotation.Resource;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 注册拦截器
 */
@Configuration
public class SpringMvcConfig implements WebMvcConfigurer{
	@Resource
	LogInterceptor logInterceptor;
	@Resource
	MemberInterceptor memberInterceptor;

	@Override
	public void addInterceptors(InterceptorRegistry registry){
		registry.addInterceptor(logInterceptor);
		registry.addInterceptor(memberInterceptor)
			// 添加所有请求
			.addPathPatterns("/**")
			// 排除的请求
			.excludePathPatterns(
				"/member/member/register",
				"/member/member/send-code",
				"/member/member/login"
			);
	}
}
